package runesim.node.model;
public class WornEquipmentParent {
	
			Item[] items = new Item[14];
			Player player;
			
			public WornEquipmentParent(Player player){
				this.player = player;
			}
			
			/**
			 * Get the player who owns this inventory object.
			 * @return
			 */
			public Player getPlayer(){
				return player;
			}
			
			public void wearSlot(int id, int slot){
				int detectedType = WEAPON; //Default will display as weapon until implemented :P
				
				if(id == 1040) detectedType = HAT;
				else detectedType = WEAPON;
				
				items[detectedType] = new Item(id, 1, detectedType);
				player.getInventory().removeItem(slot);
				player.getActionSender().sendEquipment(detectedType);
				player.getAppearance().setChanged(true);
			}
			
			public void unwearSlot(int id, int wearSlot){
				player.getInventory().addItem(id, 1); //No support for stackable items yet
				items[wearSlot] = null;
				player.getActionSender().sendEquipment(wearSlot); //Will send 0,0 (clears weapon)
				player.getAppearance().setChanged(true);
			}
			
			/**
			 * Get the item ID of the specified slot.
			 * @param slot		The slot to look up.
			 * @return			The id of the item in this slot.
			 */
			public int getID(int slot) {
				if(!isEquipped(slot))
					return -1;
				return items[slot].getID();
			}
			
			/**
			 * Get the amount of an item in the specified slot.
			 * @param slot		The slot to look up.
			 * @return			The amount of the item in this slot.
			 */
			public int getAmount(int slot) {
				if(!isEquipped(slot))
					return -1;
				return items[slot].getAmount();
			}
			
			/**
			 * Whether the specified slot has an item in it.
			 * @param slot		The slot to look up.
			 * @return
			 */
			public boolean isEquipped(int slot) {
				return items[slot] != null;
			}
			
			//Equipment types
			public static final int 
					HAT = 0, 
					CAPE = 1, 
					AMULET = 2, 
					WEAPON = 3,
			        TORSO = 4, 
			        SHIELD = 5, 
			        LEGS = 7, 
			        HANDS = 9, 
			        FEET = 10, 
			        RING = 12,
			        ARROWS = 13;
}